home *** CD-ROM | disk | FTP | other *** search
- *-----------------------------------------------------------------------
- *-- Program...: HELPROC.PRG
- *-- Programmer: Bowen Moursund (CIS: 72662,436)
- *-- Date......: 07/27/1993
- *-- Notes.....: This is designed to be a black-box procedure to handle
- *-- help screens for the user. See directions in HELPER
- *-- below. Suggest using this with SET PROC TO HELPROC or
- *-- better yet:
- *-- SET LIBR TO HELPROC
- *-- This requires the use of HELPER.DBF and HELPER.FMT.
- *-----------------------------------------------------------------------
-
- PROCEDURE Helper
- *-----------------------------------------------------------------------
- *-- Programmer..: Bowen Moursund (CIS: 76566,1405)
- *-- Date........: 01/19/1993
- *-- Notes.......: Helper is a procedure for displaying help text in a
- *-- full screen browse. The text is stored in a DBF file:
- *--
- *-- Structure for database: HELPER.DBF
- *-- Field Field Name Type Width Dec Index
- *-- 1 HELP Character 78 N
- *--
- *-- The help text may be loaded into the DBF by creating a
- *-- text file using a text editor, and importing the
- *-- contents of that file into helper.dbf in this fashion:
- *--
- *-- . use helper
- *-- . zap
- *-- . append from <text filename> sdf
- *--
- *-- Helper is designed to be called as an program
- *-- interrupt by the key label F1. Make sure to include
- *-- the line on key label F1 do helper
- *--
- *-- near the beginning of the application. The format file
- *-- Helper.fmt must be included with the application.
- *--
- *-- Written for.: dBASE IV, 1.5
- *-- Rev. History: 01/19/1993 -- Original
- *-- Calls.......: StrSrch Procedure in HELPROC.PRG (below)
- *-- HELPER.FMT
- *-- HELPER.DBF
- *-- Called by...: None
- *-- Usage.......: on key label F1 do helper
- *-- Example.....: see above
- *-- Returns.....: Nothing
- *-- Parameters..: None
- *-- WARNING.....: Do not use this procedure if it might interrupt a
- *-- dBASE BEGIN TRANSACTION. Helper opens and closes
- *-- helper.dbf, and DBFs cannot be closed while a dBASE
- *-- transaction is in progress.
- *-----------------------------------------------------------------------
-
- on key label F1 ?? "" && disable interrupt
- private cAlias, cFormat, lTalkOn, lCursOn, lScoreOn, lClockOn, ;
- lStatOn, lLoop, cStr
- m->lTalkOn = ( set( "talk" ) = "ON" )
- set talk off
- m->cStr = space(15) && to be used by search utility
- save screen to sHelpScr
- *-- save environment
- m->cAlias = alias()
- m->cFormat = set( "format" )
- m->lCursOn = ( set( "cursor" ) = "ON" )
- m->lScoreOn = ( set( "scoreboard" ) = "ON" )
- m->lClockOn = ( set( "clock" ) = "ON" )
- m->lStatOn = ( set( "status" ) = "ON" )
- m->lConsOff = ( set( "console" ) = "OFF" )
- m->lPrintOn = ( set( "printer" ) = "ON" )
- m->lFieldsOn = ( set( "fields" ) = "ON" )
-
- set printer off
- set console on
- set fields off
-
- define window wHelper from 0,0 to 23,79 none
- select select()
- use helper
- set format to helper
- set clock off
- set cursor off
- set scoreboard off
- m->lLoop = .t.
- if m->lStatOn
- set status off
- endif
- on key label F1 do strsrch
- activate window wHelper
- do while m->lLoop
- m->lLoop = .f. && procedure strsrch might set this .t.
- browse noappend noclear nomenu noedit nodelete compress format
- enddo
- deactivate window wHelper
- on key label F1 ?? ""
- use
-
- *-- restore environment
- if m->lScoreOn
- set scoreboard on
- endif
- if m->lCursOn
- set cursor on
- endif
- if m->lClockOn
- set clock on
- endif
- if "" # m->cAlias
- select ( m->cAlias )
- endif
- if "" # m->cFormat
- set format to ( m->cFormat )
- endif
- if m->lStatOn
- set status on
- endif
- if m->lConsOff
- set console off
- endif
- if m->lPrintOn
- set printer on
- endif
- if m->lFieldsOn
- set fields on
- endif
- if m->lTalkOn
- set talk on
- endif
-
- release window wHelper
- restore screen from sHelpScr
- release screen sHelpScr
- on key label F1 do helper
-
- RETURN
- *-- EoP: Helper
-
- PROCEDURE StrSrch
- *-----------------------------------------------------------------------
- *-- Programmer..: Bowen Moursund (CIS: 76566,1405)
- *-- Date........: 01/19/1993
- *-- Notes.......: String search procedure for PROCEDURE Helper
- *-- Written for.: dBASE IV, 1.5
- *-- Rev. History: 01/19/1993 -- Original
- *-- Calls.......: None
- *-- Called by...: Helper Procedure in HELPROC.PRG (above)
- *-- Usage.......: Do StrSrch
- *-- Example.....: See above
- *-- Returns.....: None
- *-- Parameters..: None
- *-----------------------------------------------------------------------
-
- on key label F1 ?? "" && disable interrupt
- private cTrimStr, cSearchStr, lSearchLoop
- close format && gotta close format because of the search string read
- m->lSearchLoop = .t.
- define window wStrSrch from 15,19 to 21,59
- define window w_Shadow from 16,17 to 22,57 none color n/n,n/n
- activate window w_Shadow
- activate window wStrSrch
- @1,10 say "HELP Search Utility"
-
- do while m->lSearchLoop
- @3,0
- *-- cStr initialized in procedure helper
- @3,4 say "Search string " + chr(16) get m->cStr function "!" ;
- message "Enter search string. Esc: Cancel"
- set cursor on
- read
- set cursor off
- m->cTrimStr = ltrim( rtrim( m->cStr ) )
- if lastkey() # 27 .and. "" # m->cTrimStr
- m->nRecNo = recno()
- m->cSearchStr = upper( m->cTrimStr )
- m->lFound = .f.
- if .not. eof()
- * look for next occurrence of m->cSearchStr
- do while .not. eof() .and. .not. m->lFound
- skip
- m->lFound = ( m->cSearchStr $ upper( help ) )
- enddo
- endif
- if .not. m->lFound
- @3,0
- ?? chr(7)
- @3,20 - (len(m->cTrimStr+" not found.")/2) ;
- say m->cTrimStr + " not found."
- i = inkey(3)
- goto m->nRecNo
- m->lSearchLoop = .t.
- else
- *-- lLoop initialized in procedure helper
- m->lLoop = .t. && re-browse after terminating
- m->lSearchLoop = .f.
- keyboard chr(23) && terminate the browse
- endif
- else
- m->lSearchLoop = .f. && exit the loop
- endif
- enddo
-
- deactivate window wStrSrch
- deactivate window w_Shadow
- release window wStrSrch
- release window w_Shadow
- set format to helper
- on key label F1 do strsrch
-
- RETURN
- *-- EoP: StrSrch
-
- *-----------------------------------------------------------------------
- *-- End of Program: HELPROC.PRG
- *-----------------------------------------------------------------------